package com.nbsaas.boot.processor;

import com.nbsaas.boot.data.ext.apis.PreProcessor;
import com.nbsaas.boot.utils.UserUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Component;

import java.util.Map;


@Component
public class ShopProcessor implements PreProcessor {
    @Override
    public void process(Map<String, Object> params) {
        if (SecurityUtils.getSubject().isAuthenticated()) {
            params.put("userId", UserUtils.user().getId());
            params.put("shopId", UserUtils.user().getShop());
        }
    }
}
